<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Thien</title>
    </head> 
    <body>
        <h1 align="center">NEW WORKS</h1>
        <?php
        require_once '../model/db.php';
        require_once '../model/keywork.php';
        require_once '../model/work.php';
        $works = new works();
        ?>  <br>
        <a href='index1.php?if=<?php echo $_GET["if"] - 1; ?>'> NEXT Prev... </a>
        <?php for ($i = 1;$i <= 19;$i++):?>
        <a href='index1.php?if=<?php echo $i; ?>'><?php echo $i; ?></a>
        
        <?php if ($_GET["if"] == $i): ?>
        <?php $works->start = (($i - 1) * 20); ?>
        <?php $works->end = 50 ?>
        
        <?php endif;?>
        
        <?php endfor;?>
        
        <a href='index1.php?if=<?php echo $_GET["if"] - 1 ?>'> PREV Last... </a> 

<?php $list_of_works = $works->select(); ?>
        <table border="1px">
            <tr>
                <td>ID</td>
                <td>NAME</td>
                <td>URL</td>
            </tr>
<?php foreach ($list_of_works as $list1): ?>
            <tr>
                <td><?php echo $list1["id"]; ?></td>
                <td><?php echo $list1["name"]; ?></td>
                <td><a href='<?php echo $list1["url"]; ?>'><?php echo $list1["url"]; ?></td>
            </tr>
<?php endforeach; ?>
        </table>
    </body>
</html>
